import request from "@/utils/request";

// 获取小区列表
export function getCommunityList(params) {
  return request({
    url: "/complex",
    method: "get",
    params,
  });
}

// 获取小区详情
export function getCommunityDetail(id) {
  return request({
    url: `/complex/${id}`,
    method: "get",
  });
}

// 创建小区
export function createCommunity(data) {
  return request({
    url: "/complex",
    method: "post",
    data,
  });
}

// 更新小区信息
export function updateCommunity(id, data) {
  return request({
    url: `/complex/${id}`,
    method: "put",
    data,
  });
}

// 删除小区
export function deleteCommunity(id) {
  return request({
    url: `/complex/${id}`,
    method: "delete",
  });
}

// 获取居委会列表
export function getNeighborhoodList(params) {
  return request({
    url: "/Committee",
    method: "get",
    params,
  });
}

// 获取居委会详情
export function getNeighborhoodDetail(id) {
  return request({
    url: `/Committee/${id}`,
    method: "get",
  });
}

// 创建居委会
export function createNeighborhood(data) {
  return request({
    url: "/Committee",
    method: "post",
    data,
  });
}

// 更新居委会信息
export function updateNeighborhood(id, data) {
  return request({
    url: `/Committee/${id}`,
    method: "put",
    data,
  });
}

// 删除居委会
export function deleteNeighborhood(id) {
  return request({
    url: `/Committee/${id}`,
    method: "delete",
  });
}

export function getComplexList(params) {
  return request({
    url: "/complex",
    method: "get",
    params,
  });
}

// 获取居委会下属小区列表
export function getCommitteeComplexes(id) {
  return request({
    url: `/Committee/${id}/complexes`,
    method: "get",
  });
}

// 获取小区房屋列表
export function getComplexHouses(id) {
  return request({
    url: `/complex/${id}/houses`,
    method: "get",
  });
}
